package com.freewater.javabase.demo.designpattern.strategy;

import java.math.BigDecimal;
import java.math.RoundingMode;

public class PrimeDiscountStrategy extends OverDiscountStrategy {

    @Override
    public BigDecimal getDiscount(BigDecimal total) {
        // 在满100减20的基础上对Prime会员再打七折
        final BigDecimal discount1 = super.getDiscount(total);
        return discount1.add(total.subtract(discount1).multiply(new BigDecimal("0.3")).setScale(2, RoundingMode.DOWN));
    }
}
